<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
         /**
         * 数组解构
         * 1. 允许数组嵌套
         * 2. 允许空缺变量名
         * 3. 如果解构不成功，变量的值就等于Undefined
         * */


        // let a = 1;
        // let b = 2;
        // let c = 3;

        // 改写
        // TODO 数组解构
        let [a,b,c] = [1,2,3];
        console.log(a, b, c); // 1 2 3

        // TODO 数组嵌套
        let [a2, [b2,c2]] = [1, [2,3]];
        console.log(a2, b2, c2);// 1 2 3

        // TODO 允许空缺变量名
        let [,,c3] = [1,2,3];
        console.log(c3);

        // TODO 允许空缺值, 未赋值为undefined
        let [a4,b4,c4] = [5,,6];
        console.log(a4,b4,c4);// 5 undefined 6
        
    </script>
</head>
<body>
    
</body>
</html>